package com.jfinal.weixin.demo.chengyu;

/**
 * Created by wangxiaoyang on 16/8/28.
 */
public class ChengyuBean {
    public String error_code = "";
    public String reason = "";
    public Item result;

    public String format() {
        if( null == result ) {
            return "成语查询失败";
        }
        StringBuffer chengyu = new StringBuffer();
        chengyu.append( result.name );
        chengyu.append(" 读作: ");
        chengyu.append( result.spell);
        chengyu.append("\n意义: ");
        chengyu.append(result.content);
        chengyu.append("\n出处: ");
        chengyu.append(result.derivation);
        chengyu.append("\n使用范例: ");
        chengyu.append(result.samples);
        return chengyu.toString();
    }

    public static class Item {
        public String id = "";
        public String name = "";
        public String spell = "";
        public String content = "";
        public String derivation = "";
        public String samples = "";
    }
}
